import mysql.connector
mydb = mysql.connector.connect(
  host="xxxx",       # 数据库主机地址
  user="xxxx",    # 数据库用户名
  passwd="xxxx",
  database="muse"   # 数据库密码
)
mycursor = mydb.cursor()
f=open("output.txt","r")
img_list=f.readlines()
img_lists=[]
for img in img_list:
    timg=img.split()
    timg[0]=timg[0].rstrip(".jpg")
    img_lists.append(timg)
sql = "INSERT INTO img_url_table (img_id, url) VALUES (%s, %s)"
for i in range(len(img_lists)):
    mycursor.execute(sql, img_lists[i])
mydb.commit()